package org.shoukaiseki.aliyun.oss.config;

import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.util.StringUtils;

/**
 * 暂时没做配置
 * org.shoukaiseki.aliyun.oss.config.BaseOSSProperties
 * <br>
 *
 * @author shoukaiseki ブログ http://www.shoukaiseki.top/<br> E-メール jiang28555@Gmail.com<br>
 * @date 2020-12-11 13:10:01<br>
 */
public class BaseOSSProperties {

    private String savePath;


    private String maxFileSize="1MB";

    public String getSavePath() {
        return savePath;
    }

    public void setSavePath(String savePath) {
        this.savePath = savePath;
    }

    public String getMaxFileSize() {
        return maxFileSize;
    }

    public void setMaxFileSize(String maxFileSize) {
        this.maxFileSize = maxFileSize;
    }

    public BaseOSSConfigElement createMultipartConfig() {
        BaseOSSConfigFactory factory = new BaseOSSConfigFactory();
        if (StringUtils.hasText(this.savePath)) {
            factory.setSavePath(this.savePath);
        }


        if (StringUtils.hasText(this.maxFileSize)) {
            factory.setFileMaxSize(this.maxFileSize);
        }

        return factory.createMultipartConfig();
    }

    @Override
    public String toString() {
        return "BaseOSSProperties{" +
                "savePath='" + savePath + '\'' +
                ", maxFileSize='" + maxFileSize + '\'' +
                '}';
    }
}
